//
//  HotListenListHeaderView.m
//  NewMusic
//
//  Created by dllo on 15/11/18.
//  Copyright © 2015年 Going. All rights reserved.
//

#import "HotListenListHeaderView.h"
#import <SDWebImageManager.h>
#import <UIImageView+WebCache.h>
@interface HotListenListHeaderView ()
@property(nonatomic, retain) UILabel *nameLabel;
@end

@implementation HotListenListHeaderView
- (void)dealloc {
    [_nameLabel release];
    [_picImageView release];
    [_listeView release];
    [_picString release];
    [_shareString release];
    [_likeString release];
    [_nameStrirng release];
    [super dealloc];
}
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
       //创建视图
        [self createSubView];
    }
    return self;
}
#pragma mark 创建视图
- (void)createSubView {
    self.picImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    [self addSubview:_picImageView];
    [_picImageView release];
    
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, self.frame.size.height / 2, self.frame.size.width - 20, 30)];
    _nameLabel.textColor = [UIColor whiteColor];
    _nameLabel.font = [UIFont fontWithName:@"HelveticaNeue-Bold" size:19];
//    _nameLabel.backgroundColor = [UIColor redColor];
    [self addSubview:_nameLabel];
    [_nameLabel release];
    
    self.listeView = [[HotListenListView alloc]initWithFrame:CGRectMake(0, self.frame.size.height - 50, self.frame.size.width, 50)];
    [self addSubview:_listeView];
    [_listeView release];
}
#pragma mark 重写picString的setter方法
- (void)setPicString:(NSString *)picString {
    if (_picString != picString) {
        [_picString release];
        _picString = [picString copy];
    }
    [_picImageView sd_setImageWithURL:[NSURL URLWithString:picString]];
}
#pragma mark 重写shareString的setter方法
- (void)setShareString:(NSString *)shareString {
    if (_shareString != shareString) {
        [_shareString release];
        _shareString = [shareString copy];
    }
    _listeView.shareString = shareString;
}
#pragma mark 重写likeString的setter方法
- (void)setLikeString:(NSString *)likeString {
    if (_likeString != likeString) {
        [_likeString release];
        _likeString = [likeString copy];
    }
    _listeView.likeString = likeString;
}
#pragma mark 重写nameStrirng的setter方法
- (void)setNameStrirng:(NSString *)nameStrirng {
    if (_nameStrirng != nameStrirng) {
        [_nameStrirng release];
        _nameStrirng = [nameStrirng retain];
    }
    _nameLabel.text = nameStrirng;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
